using CommunityToolkit.Mvvm.ComponentModel;

namespace Koala.Pro.Models;

public partial class PagingData : ObservableObject
{
    [ObservableProperty]
    private int _PageSize = 10;

    [ObservableProperty]
    private int _CurrentPageIndex = 1;

    [ObservableProperty]
    private int _MaxPageCount = 10;

    private int recordCount;

    public int RecordCount
    {
        get
        {
            return recordCount;
        }
        set
        {
            recordCount = value;
            MaxPageCount = ((PageSize == 0) ? 1 : ((int)Math.Ceiling((decimal)RecordCount / (decimal)PageSize)));
            OnPropertyChanged("RecordCount");
        }
    }

}
